// 首页
// http://45.207.33.232:3400/

// 登录
// http://45.207.33.232:3400/login

// 接单
// http://45.207.33.232:3302/Order/receive_Order/


let token = Android.getMap("token")
document.cookie = token


function getParameterHandler() {
    let token = parameter.getMap("token")
    let headers = {
        "cookie": token
    }
    let coks = token.split(";")
    let buyerId = coks[0].split("=")[1]
    let body = {
        "buyerId": buyerId,
        "version": "1.5"
    }
    let strUrl = ``
    let url = parameter.getMap("url") + strUrl
    return {
        mediaType: "form",
        requestType: "POST",
        url: url,
        headers: JSON.stringify(headers),
        body: JSON.stringify(body)
    }
}
getParameterHandler()



function getResponse() {
    let res = response.getMap("res")
    res = JSON.parse(res)

    let code = "500"
    let message = res["remark"]
    
    if (res["rescode"] == "00000") {
        code = "200"
    } else if (res["rescode"] == "E0004") {
        code = "500"
    } else {
        code = "300"
    }

    return {
        code: code,
        message: message,
        dataKey: "",
        dataValue: ""
    }

}
getResponse()

// {
//     "remark": "get order count succ",
//     "complete": 20,
//     "rescode": "00000",
//     "waitConfirm": 0,
//     "waitEvaluate": 1,
//     "waitMoneyReturn": 0,
//     "waitOperate": 0
// }

// {
// 	"remark": "接单中",
// 	"rescode": "E0004"
// }

// {"remark": "can not get userid from post", "rescode": "E4000"}